package com.game.tank.bean;

import com.game.tank.TankFrame;
import com.game.tank.enums.Dir;
import com.game.tank.enums.TankGroup;
import com.game.tank.loader.ResourceMgr;

import java.awt.*;
import java.awt.image.BufferedImage;

public class Explode {

    public static int WIDTH = ResourceMgr.explodes[0].getWidth();
    public static int HEIGHT = ResourceMgr.explodes[0].getHeight();

    //坦克的初始位置
    private int x, y;
    private int step = 0;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    private boolean live = true;

    private TankFrame tf = null;

    public Explode() {

    }

    public Explode(int x, int y, TankFrame tf) {
        this.x =x;
        this.y = y;
        this.tf = tf;
    }


    //画出坦克，根据方向移动
    public void paint(Graphics graphics) {
        if (step > 16) {
            tf.explodes.remove(this);
            step = 0;
            return;
        }
        graphics.drawImage(ResourceMgr.explodes[step++], x, y, null);
    }




    public void die() {
        live = false;
    }

    public boolean isLive() {
        return live;
    }

    public void setLive(boolean live) {
        this.live = live;
    }
}
